<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>37.3. macostools — Convenience routines for file manipulation &mdash; Python v2.6.2 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.2',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.2 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.2 documentation" href="../index.html" />
    <link rel="up" title="37. Mac OS X specific services" href="mac.html" />
    <link rel="next" title="37.5. EasyDialogs — Basic Macintosh dialogs" href="easydialogs.html" />
    <link rel="prev" title="37.2. MacOS — Access to Mac OS interpreter features" href="macos.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="easydialogs.html" title="37.5. EasyDialogs — Basic Macintosh dialogs"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="macos.html" title="37.2. MacOS — Access to Mac OS interpreter features"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="mac.html" accesskey="U">37. Mac OS X specific services</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-macostools">
<h1>37.3. <tt class="xref docutils literal"><span class="pre">macostools</span></tt> &#8212; Convenience routines for file manipulation<a class="headerlink" href="#module-macostools" title="Permalink to this headline">¶</a></h1>
<p><em>Platforms: </em>Mac</p>
<p>This module contains some convenience routines for file-manipulation on the
Macintosh. All file parameters can be specified as pathnames, <tt class="xref docutils literal"><span class="pre">FSRef</span></tt> or
<tt class="xref docutils literal"><span class="pre">FSSpec</span></tt> objects.  This module expects a filesystem which supports forked
files, so it should not be used on UFS partitions.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">This module is removed in 3.0.</p>
</div>
<p>The <tt class="xref docutils literal"><span class="pre">macostools</span></tt> module defines the following functions:</p>
<dl class="function">
<dt id="macostools.copy">
<tt class="descclassname">macostools.</tt><tt class="descname">copy</tt><big>(</big><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>createpath</em><span class="optional">[</span>, <em>copytimes</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#macostools.copy" title="Permalink to this definition">¶</a></dt>
<dd>Copy file <em>src</em> to <em>dst</em>.  If <em>createpath</em> is non-zero the folders leading to
<em>dst</em> are created if necessary. The method copies data and resource fork and
some finder information (creator, type, flags) and optionally the creation,
modification and backup times (default is to copy them). Custom icons, comments
and icon position are not copied.</dd></dl>

<dl class="function">
<dt id="macostools.copytree">
<tt class="descclassname">macostools.</tt><tt class="descname">copytree</tt><big>(</big><em>src</em>, <em>dst</em><big>)</big><a class="headerlink" href="#macostools.copytree" title="Permalink to this definition">¶</a></dt>
<dd>Recursively copy a file tree from <em>src</em> to <em>dst</em>, creating folders as needed.
<em>src</em> and <em>dst</em> should be specified as pathnames.</dd></dl>

<dl class="function">
<dt id="macostools.mkalias">
<tt class="descclassname">macostools.</tt><tt class="descname">mkalias</tt><big>(</big><em>src</em>, <em>dst</em><big>)</big><a class="headerlink" href="#macostools.mkalias" title="Permalink to this definition">¶</a></dt>
<dd>Create a finder alias <em>dst</em> pointing to <em>src</em>.</dd></dl>

<dl class="function">
<dt id="macostools.touched">
<tt class="descclassname">macostools.</tt><tt class="descname">touched</tt><big>(</big><em>dst</em><big>)</big><a class="headerlink" href="#macostools.touched" title="Permalink to this definition">¶</a></dt>
<dd><p>Tell the finder that some bits of finder-information such as creator or type for
file <em>dst</em> has changed. The file can be specified by pathname or fsspec. This
call should tell the finder to redraw the files icon.</p>
<p>
<span class="versionmodified">Deprecated since version 2.6: </span>The function is a no-op on OS X.</p>
</dd></dl>

<dl class="data">
<dt id="macostools.BUFSIZ">
<tt class="descclassname">macostools.</tt><tt class="descname">BUFSIZ</tt><a class="headerlink" href="#macostools.BUFSIZ" title="Permalink to this definition">¶</a></dt>
<dd>The buffer size for <tt class="docutils literal"><span class="pre">copy</span></tt>, default 1 megabyte.</dd></dl>

<p>Note that the process of creating finder aliases is not specified in the Apple
documentation. Hence, aliases created with <a title="macostools.mkalias" class="reference internal" href="#macostools.mkalias"><tt class="xref docutils literal"><span class="pre">mkalias()</span></tt></a> could conceivably
have incompatible behaviour in some cases.</p>
</div>
<div class="section" id="module-findertools">
<h1>37.4. <tt class="xref docutils literal"><span class="pre">findertools</span></tt> &#8212; The <strong>finder</strong>&#8216;s Apple Events interface<a class="headerlink" href="#module-findertools" title="Permalink to this headline">¶</a></h1>
<p><em>Platforms: </em>Mac</p>
<p id="index-407">This module contains routines that give Python programs access to some
functionality provided by the finder. They are implemented as wrappers around
the AppleEvent interface to the finder.</p>
<p>All file and folder parameters can be specified either as full pathnames, or as
<tt class="xref docutils literal"><span class="pre">FSRef</span></tt> or <tt class="xref docutils literal"><span class="pre">FSSpec</span></tt> objects.</p>
<p>The <tt class="xref docutils literal"><span class="pre">findertools</span></tt> module defines the following functions:</p>
<dl class="function">
<dt id="findertools.launch">
<tt class="descclassname">findertools.</tt><tt class="descname">launch</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#findertools.launch" title="Permalink to this definition">¶</a></dt>
<dd>Tell the finder to launch <em>file</em>. What launching means depends on the file:
applications are started, folders are opened and documents are opened in the
correct application.</dd></dl>

<dl class="function">
<dt id="findertools.Print">
<tt class="descclassname">findertools.</tt><tt class="descname">Print</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#findertools.Print" title="Permalink to this definition">¶</a></dt>
<dd>Tell the finder to print a file. The behaviour is identical to selecting the
file and using the print command in the finder&#8217;s file menu.</dd></dl>

<dl class="function">
<dt id="findertools.copy">
<tt class="descclassname">findertools.</tt><tt class="descname">copy</tt><big>(</big><em>file</em>, <em>destdir</em><big>)</big><a class="headerlink" href="#findertools.copy" title="Permalink to this definition">¶</a></dt>
<dd>Tell the finder to copy a file or folder <em>file</em> to folder <em>destdir</em>. The
function returns an <tt class="xref docutils literal"><span class="pre">Alias</span></tt> object pointing to the new file.</dd></dl>

<dl class="function">
<dt id="findertools.move">
<tt class="descclassname">findertools.</tt><tt class="descname">move</tt><big>(</big><em>file</em>, <em>destdir</em><big>)</big><a class="headerlink" href="#findertools.move" title="Permalink to this definition">¶</a></dt>
<dd>Tell the finder to move a file or folder <em>file</em> to folder <em>destdir</em>. The
function returns an <tt class="xref docutils literal"><span class="pre">Alias</span></tt> object pointing to the new file.</dd></dl>

<dl class="function">
<dt id="findertools.sleep">
<tt class="descclassname">findertools.</tt><tt class="descname">sleep</tt><big>(</big><big>)</big><a class="headerlink" href="#findertools.sleep" title="Permalink to this definition">¶</a></dt>
<dd>Tell the finder to put the Macintosh to sleep, if your machine supports it.</dd></dl>

<dl class="function">
<dt id="findertools.restart">
<tt class="descclassname">findertools.</tt><tt class="descname">restart</tt><big>(</big><big>)</big><a class="headerlink" href="#findertools.restart" title="Permalink to this definition">¶</a></dt>
<dd>Tell the finder to perform an orderly restart of the machine.</dd></dl>

<dl class="function">
<dt id="findertools.shutdown">
<tt class="descclassname">findertools.</tt><tt class="descname">shutdown</tt><big>(</big><big>)</big><a class="headerlink" href="#findertools.shutdown" title="Permalink to this definition">¶</a></dt>
<dd>Tell the finder to perform an orderly shutdown of the machine.</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../contents.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">37.3. <tt class="docutils literal"><span class="pre">macostools</span></tt> &#8212; Convenience routines for file manipulation</a></li>
<li><a class="reference external" href="#module-findertools">37.4. <tt class="docutils literal"><span class="pre">findertools</span></tt> &#8212; The <strong>finder</strong>&#8216;s Apple Events interface</a></li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="macos.html"
                                  title="previous chapter">37.2. <tt class="docutils literal docutils literal docutils literal"><span class="pre">MacOS</span></tt> &#8212; Access to Mac OS interpreter features</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="easydialogs.html"
                                  title="next chapter">37.5. <tt class="docutils literal docutils literal docutils literal"><span class="pre">EasyDialogs</span></tt> &#8212; Basic Macintosh dialogs</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/library/macostools.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="easydialogs.html" title="37.5. EasyDialogs — Basic Macintosh dialogs"
             >next</a> |</li>
        <li class="right" >
          <a href="macos.html" title="37.2. MacOS — Access to Mac OS interpreter features"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.6.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="mac.html" >37. Mac OS X specific services</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; <a href="../copyright.html">Copyright</a> 1990-2009, Python Software Foundation.
      Last updated on Apr 15, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
    </div>
  </body>
</html>